package com.hx.base.innerclass;

import java.awt.*;

/**
 * @author jxlgcmh
 * @date 2020-08-16 11:10
 * @description 匿名内部类
 */
public class AnonymousInnerClass {

    public void test(final int x, final int y) {
        Point point = new Point(0, 0) {
            //  @Override
            public double distance() {
                return distance(new Point(x, y));
            }
        };
        System.out.println(point.distance(x, y));
    }

    public static void main(String[] args) {
        AnonymousInnerClass innerClass = new AnonymousInnerClass();
        innerClass.test(3, 4);
//        Point point = new Point();
//        double distance = point.distance(3, 4);
//        System.out.println(distance);
    }
}
